package com.itheima.controller;

import com.itheima.pojo.vo.DataStatistics;
import com.itheima.pojo.Result;
import com.itheima.pojo.vo.EmpJobData;
import com.itheima.pojo.vo.StuCountData;
import com.itheima.service.DataStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/report")
public class DataStatisticsController {
    @Autowired
    private DataStatisticsService dataStatisticsService;
    @GetMapping("/empGenderData")
    public Result dataStatistics() {
        List<DataStatistics> statistics = dataStatisticsService.statistics();
        return Result.success(statistics);
    }
    @GetMapping("/empJobData")
    public Result empJobData() {
        EmpJobData categories = dataStatisticsService.findCategories();
        return Result.success(categories);
    }
    @GetMapping("/studentDegreeData")
    public Result studentDegreeData(){
        List<DataStatistics> dataStatistics = dataStatisticsService.studentDegreeData();
        return Result.success(dataStatistics);
    }
    @GetMapping("/studentCountData")
    public Result studentCountData(){
        StuCountData data = dataStatisticsService.studentCountData();
        return Result.success(data);
    }
}
